package com.ssm.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


import javax.servlet.http.HttpSession;
import java.util.Enumeration;

public class BaseController {
    protected Logger logger= LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);

    protected  String checkAdmin(HttpSession session){



        Object o1=session.getAttribute("studentId");
        if (o1!=null){
            logger.info("权限验证成功，为学生ID：{}",o1);
            return "studentId";
        }
        Object o2=session.getAttribute("teacherId");
        if (o2!=null){
            logger.info("权限验证成功，为教师ID：{}",o2);
            return "teacherId";
        }
        Object o=session.getAttribute("adminId");
        if (o!=null){
            logger.info("权限验证成功，为管理员ID：{}",o);
            return "adminId";
        }
        return "";
    }
}
